package com.wenmingliang.demo2.com.wenmingliang.demo1;

import java.util.*;

public class chExercise1 extends ArrayList {

    public static void main(String[] args) {

        Collection collection = new ArrayList();
        collection.add(1);
        collection.add(2);
        collection.add(3);
        collection.add(5);
        collection.add(6);
        collection.add(7);
        collection.add(8);
        collection.add(9);

        System.out.println(collection);

        Iterator iterator = collection.iterator();

//        while (iterator.hasNext()) {
//            System.out.println(iterator.next());
//        }

        for (int i = 0; i < collection.size(); i++) {
            System.out.println(iterator.next());
        }

    }

}
